package facilius.controller.actionmanager;

import facilius.controller.ActionManager;
import facilius.controller.action.espaco.EspacoAulasReadAction;
import facilius.controller.action.espaco.EspacoFrequenciaReadAction;
import facilius.controller.action.espaco.EspacoNotasReadAction;
import org.mentawai.authorization.Permission;
import org.mentawai.core.ActionConfig;
import org.mentawai.core.ApplicationManager;
import org.mentawai.core.Forward;
import org.mentawai.filter.AuthorizationFilter;

/**
 *
 * @author Graciano
 */
public class EspacoActionManager implements ActionManager {

    public void loadActions(ApplicationManager appManager) {
        ActionConfig ac = null;

        ac = new ActionConfig("EspacoNotaRead", EspacoNotasReadAction.class);
        ac.addConsequence(appManager.SUCCESS, new Forward("jsp/espaco/espacoNotasList.page"));
        ac.addConsequence(appManager.ERROR, new Forward("jsp/erro.page"));
        ac.addFilter(new AuthorizationFilter(new Permission("espaco")));
        appManager.addActionConfig(ac);

        ac = new ActionConfig("EspacoAulaRead", EspacoAulasReadAction.class);
        ac.addConsequence(appManager.SUCCESS, new Forward("jsp/espaco/espacoAulasList.page"));
        ac.addConsequence(appManager.ERROR, new Forward("jsp/erro.page"));
        ac.addFilter(new AuthorizationFilter(new Permission("espaco")));
        appManager.addActionConfig(ac);

        ac = new ActionConfig("EspacoFrequenciaRead", EspacoFrequenciaReadAction.class);
        ac.addConsequence(appManager.SUCCESS, new Forward("jsp/espaco/espacoFrequenciaList.page"));
        ac.addConsequence(appManager.ERROR, new Forward("jsp/erro.page"));
        ac.addFilter(new AuthorizationFilter(new Permission("espaco")));
        appManager.addActionConfig(ac);
    }
}
